<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="style.css" />
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
<title>LoT Analytics Engine</title>
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<script src="jquery-ui-timepicker-addon.js"></script>
<script>
        var host = "lot-analytics-engine:9999";
		$(function() {
			$('#datepicker').datetimepicker({ dateFormat: "dd/mm/yy" });
			$('#datepicker1').datetimepicker({ dateFormat: "dd/mm/yy" });
			$('#datepicker2').datetimepicker({ dateFormat: "dd/mm/yy" });
			$('#datepicker3').datetimepicker({ dateFormat: "dd/mm/yy" });
			$('#datepicker4').datetimepicker({ dateFormat: "dd/mm/yy" });
			$('#datepicker5').datetimepicker({ dateFormat: "dd/mm/yy" });
			$('#datepicker6').datetimepicker({ dateFormat: "dd/mm/yy" });
			$('#datepicker7').datetimepicker({ dateFormat: "dd/mm/yy" });
		  });

        
        function showScenarioDiv(scenarioId){
        	if(scenarioId == 1){
        		document.getElementById('scenario1Div').style.display='block';
        		document.getElementById('scenario2Div').style.display='none';
        		document.getElementById('scenario3Div').style.display='none';
        		document.getElementById('scenario4Div').style.display='none';
        		document.getElementById('scenario5Div').style.display='none';
        		document.getElementById('home_welcome').style.display='none';
        		document.getElementById('home_contact').style.display='none';
        		document.getElementById('home_design').style.display='none';
        	}
        	
        	if(scenarioId == 2){
        		document.getElementById('scenario1Div').style.display='none';
        		document.getElementById('scenario2Div').style.display='block';
        		document.getElementById('scenario3Div').style.display='none';
        		document.getElementById('scenario4Div').style.display='none';
        		document.getElementById('scenario5Div').style.display='none';
        		document.getElementById('home_welcome').style.display='none';
        		document.getElementById('home_contact').style.display='none';
        		document.getElementById('home_design').style.display='none';
        	}
        	
        	if(scenarioId == 3){
        		document.getElementById('scenario1Div').style.display='none';
        		document.getElementById('scenario2Div').style.display='none';
        		document.getElementById('scenario3Div').style.display='block';
        		document.getElementById('scenario4Div').style.display='none';
        		document.getElementById('scenario5Div').style.display='none';
        		document.getElementById('home_welcome').style.display='none';
        		document.getElementById('home_contact').style.display='none';
        		document.getElementById('home_design').style.display='none';
        		document.getElementById('home_about').style.display='none';
        	}
        	
        	if(scenarioId == 4){
        		document.getElementById('scenario1Div').style.display='none';
        		document.getElementById('scenario2Div').style.display='none';
        		document.getElementById('scenario3Div').style.display='none';
        		document.getElementById('scenario4Div').style.display='block';
        		document.getElementById('scenario5Div').style.display='none';
        		document.getElementById('home_welcome').style.display='none';
        		document.getElementById('home_contact').style.display='none';
        		document.getElementById('home_design').style.display='none';
        		document.getElementById('home_about').style.display='none';
        	}
        	
        	if(scenarioId == 5){
        		document.getElementById('scenario1Div').style.display='none';
        		document.getElementById('scenario2Div').style.display='none';
        		document.getElementById('scenario3Div').style.display='none';
        		document.getElementById('scenario4Div').style.display='none';
        		document.getElementById('scenario5Div').style.display='block';
        		document.getElementById('home_welcome').style.display='none';
        		document.getElementById('home_contact').style.display='none';
        		document.getElementById('home_design').style.display='none';
        		document.getElementById('home_about').style.display='none';
        	}
        	
        	if(scenarioId == 6){
        		document.getElementById('scenario1Div').style.display='none';
        		document.getElementById('scenario2Div').style.display='none';
        		document.getElementById('scenario3Div').style.display='none';
        		document.getElementById('scenario4Div').style.display='none';
        		document.getElementById('scenario5Div').style.display='none';
        		document.getElementById('home_welcome').style.display='block';
        		document.getElementById('home_contact').style.display='none';
        		document.getElementById('home_design').style.display='none';
        		document.getElementById('home_about').style.display='none';
        	}

        	if(scenarioId == 7){
        		document.getElementById('scenario1Div').style.display='none';
        		document.getElementById('scenario2Div').style.display='none';
        		document.getElementById('scenario3Div').style.display='none';
        		document.getElementById('scenario4Div').style.display='none';
        		document.getElementById('scenario5Div').style.display='none';
        		document.getElementById('home_welcome').style.display='none';
        		document.getElementById('home_contact').style.display='block';
        		document.getElementById('home_design').style.display='none';
        		document.getElementById('home_about').style.display='none';
        	}

        	if(scenarioId == 8){
        		document.getElementById('scenario1Div').style.display='none';
        		document.getElementById('scenario2Div').style.display='none';
        		document.getElementById('scenario3Div').style.display='none';
        		document.getElementById('scenario4Div').style.display='none';
        		document.getElementById('scenario5Div').style.display='none';
        		document.getElementById('home_welcome').style.display='none';
        		document.getElementById('home_contact').style.display='none';
        		document.getElementById('home_design').style.display='block';
        		document.getElementById('home_about').style.display='none';
        	}

        	if(scenarioId == 9){
        		document.getElementById('scenario1Div').style.display='none';
        		document.getElementById('scenario2Div').style.display='none';
        		document.getElementById('scenario3Div').style.display='none';
        		document.getElementById('scenario4Div').style.display='none';
        		document.getElementById('scenario5Div').style.display='none';
        		document.getElementById('home_welcome').style.display='none';
        		document.getElementById('home_contact').style.display='none';
        		document.getElementById('home_design').style.display='none';
        		document.getElementById('home_about').style.display='block';
        	}
        }
        
        function preselectedValues(scenarioId){
        	if(scenarioId == 1){
        		document.getElementById('researchId').value='Ucl';
        		document.getElementById('groupId').value='home';
        		document.getElementById('srcId').value='12311';
        		document.getElementById('leafType').value='deviceType';
        		document.getElementById('analyticsgraphType').value='l';
        		document.getElementById('timeScale').value='hourly';
        		document.getElementById('analyticsUnit').value='f';
        		document.getElementById('datepicker').value='08/09/2013 00:00';
        		document.getElementById('datepicker1').value='09/09/2013 00:00';
        		var drp = document.getElementById("leafValue");
				document.getElementById('leafValue').options.length = 0;
        		var optn = document.createElement("OPTION"); 
				optn.text="Door";  
				optn.value="door"; 
				drp.add(optn);
           	}

        	if(scenarioId == 2){
        		document.getElementById('xresearchId').value='MS-R1';
        		document.getElementById('xgroupId').value='home';
        		document.getElementById('xsrcId').value='';
        		document.getElementById('xleafType').value='deviceType';

        		document.getElementById('yresearchId').value='MS-R1';
        		document.getElementById('ygroupId').value='home';
        		document.getElementById('ysrcId').value='';
        		document.getElementById('yleafType').value='deviceType';

        		var drp = document.getElementById("xleafValue");
				document.getElementById('xleafValue').options.length = 0;
        		var optn8 = document.createElement("OPTION"); 
				optn8.text="Cooling";  
				optn8.value="cooling"; 
				drp.add(optn8);

				var drp = document.getElementById("yleafValue");
				document.getElementById('yleafValue').options.length = 0;
        		var optn9 = document.createElement("OPTION"); 
				optn9.text="Temperature";  
				optn9.value="temperature"; 
				drp.add(optn9);
				
        		document.getElementById('corrmodel').value='pearson';
        		document.getElementById('corrtimeScale').value='hourly';
        		document.getElementById('xcorrUnit').value='e';
        		document.getElementById('ycorrUnit').value='deg';
        		document.getElementById('datepicker2').value='08/09/2013 00:00';
        		document.getElementById('datepicker3').value='10/09/2013 00:00';
        		
           	}

        	if(scenarioId == 3){
        		document.getElementById('anomresearchId').value='';
        		document.getElementById('anomgroupId').value='';
        		document.getElementById('anomsrcId').value='';
        		document.getElementById('anomleafType').value='location';
        		document.getElementById('anomtimeScale').value='hourly';
        		document.getElementById('anomUnit').value='hrm';
        		document.getElementById('datepicker4').value='08/09/2013 00:00';
        		document.getElementById('datepicker5').value='10/09/2013 00:00';
        		var drp = document.getElementById("anomleafValue");
				document.getElementById('anomleafValue').options.length = 0;
        		var optn = document.createElement("OPTION"); 
				optn.text="Leicester";  
				optn.value="Leicester"; 
				drp.add(optn);
           	}

        	if(scenarioId == 4){
        		document.getElementById('sdresearchId').value='Ucl';
        		document.getElementById('sdgroupId').value='home';
        		document.getElementById('sdsrcId').value='12344';
        		document.getElementById('sdleafType').value='';
        		document.getElementById('sdtimeScale').value='hourly';
        		document.getElementById('sdUnit').value='deg';
        		document.getElementById('datepicker6').value='08/09/2013 00:00';
        		document.getElementById('datepicker7').value='10/09/2013 00:00';
        		document.getElementById('sdgraphType').value='l';
        		var drp = document.getElementById("sdleafValue");
				document.getElementById('sdleafValue').options.length = 0;
        		var optn = document.createElement("OPTION"); 
				optn.text="ALL";  
				optn.value=""; 
				drp.add(optn);
           	}
        }
        
        function validate(scenarioId){
        	if(scenarioId == 1){
				if(document.getElementById('researchId').value == 'select'){
        			alert('Please select Research Id!');
        			document.getElementById('researchId').focus();
        			return false;
				        			
				}
				if(document.getElementById('groupId').value == 'select'){
					alert('Please select Group Id!');
					document.getElementById('groupId').focus();
        			return false;
					
				}
				if(document.getElementById('srcId').value == 'select'){
					alert('Please select Source Id!');
					document.getElementById('srcId').focus();
        			return false;
					
				}
        		if(document.getElementById('leafValue').value == 'select'){
        			alert('Please select Leaf Value!');
        			document.getElementById('leafValue').focus();
        			return false;        			
        		}
        		if(document.getElementById('leafType').value == 'select'){
        			alert('Please select Leaf Type!');
        			document.getElementById('leafType').focus();
        			return false;        			
        		}

        		if(document.getElementById('analyticsgraphType').value == 'select'){
        			alert('Please select Graph Type!');
        			document.getElementById('analyticsgraphType').focus();
        			return false;        			
        		}

        		if(document.getElementById('datepicker').value == ''){
        			alert('Please select From Date and Time!');
        			document.getElementById('datepicker').focus();
        			return false;        			
        		}
        		
        		if(document.getElementById('datepicker1').value == ''){
        			alert('Please select To Date and Time!');
        			document.getElementById('datepicker1').focus();
        			return false;        			
        		}
        		
        		if(document.getElementById('timeScale').value == 'select'){
        			alert('Please select Time Scale!');
        			document.getElementById('timeScale').focus();
        			return false;        			
        		}
        		
        		
        	}
        	
        	if(scenarioId == 2){
				if(document.getElementById('xresearchId').value == 'select'){
        			alert('Please select xResearch Id!');
        			document.getElementById('xresearhId').focus();
        			return false;				        			
				}
				
				if(document.getElementById('xgroupId').value == 'select'){
					alert('Please select xGroup Id!');
					document.getElementById('xgroupId').focus();
        			return false;
					
				}
				if(document.getElementById('xsrcId').value == 'select'){
					alert('Please select xSource Id!');
					document.getElementById('xsrcId').focus();
        			return false;
					
				}
				if(document.getElementById('yresearchId').value == 'select'){
        			alert('Please select yResearch Id!');
        			document.getElementById('yresearchId').focus();
        			return false;				        			
				}
				
				if(document.getElementById('ygroupId').value == 'select'){
					alert('Please select yGroup Id!');
					document.getElementById('ygroupId').focus();
        			return false;
					
				}
				if(document.getElementById('ysrcId').value == 'select'){
					alert('Please select ySource Id!');
					document.getElementById('ysrcId').focus();
        			return false;
					
				}
        		if(document.getElementById('xleafValue').value == 'select'){
        			alert('Please select xLeaf Value!');
        			document.getElementById('xleafValue').focus();
        			return false;        			
        		}
        		if(document.getElementById('yleafValue').value == 'select'){
        			alert('Please select yLeaf Value!');
        			document.getElementById('yleafValue').focus();
        			return false;        			
        		}
        		if(document.getElementById('xleafType').value == 'select'){
        			alert('Please select xLeaf Type!');
        			document.getElementById('xleafType').focus();
        			return false;        			
        		}
        		if(document.getElementById('yleafType').value == 'select'){
        			alert('Please select yLeaf Type!');
        			document.getElementById('yleafType').focus();
        			return false;        			
        		}
        		if(document.getElementById('corrtimeScale').value == 'select'){
        			alert('Please select Time Scale!');
        			document.getElementById('corrtimeScale').focus();
        			return false;        			
        		}
        		if(document.getElementById('corrgraphType').value == 'select'){
        			alert('Please select Graph Type!');
        			document.getElementById('corrgraphType').focus();
        			return false;        			
        		}
        		if(document.getElementById('corrmodel').value == 'select'){
        			alert('Please select Model!');
        			document.getElementById('corrmodel').focus();
        			return false;        			
        		}
        		if(document.getElementById('datepicker2').value == ''){
        			alert('Please select From Date and Time!');
        			document.getElementById('datepicker2').focus();
        			return false;        			
        		}
        		
        		if(document.getElementById('datepicker3').value == ''){
        			alert('Please select To Date and Time!');
        			document.getElementById('datepicker3').focus();
        			return false;        			
        		}       		
        	}
        	
        	if(scenarioId == 3){
        		if(document.getElementById('anomresearchId').value == 'select'){
        			alert('Please select Research Id!');
        			document.getElementById('anomresearchId').focus();
        			return false;
				        			
				}
				if(document.getElementById('anomgroupId').value == 'select'){
					alert('Please select Group Id!');
					document.getElementById('anomgroupId').focus();
        			return false;
					
				}
				if(document.getElementById('anomsrcId').value == 'select'){
					alert('Please select Source Id!');
					document.getElementById('anomsrcId').focus();
        			return false;
					
				}
        		if(document.getElementById('anomleafValue').value == 'select'){
        			alert('Please select Leaf Value!');
        			document.getElementById('anomleafValue').focus();
        			return false;        			
        		}
        		if(document.getElementById('anomleafType').value == 'select'){
        			alert('Please select Leaf Type!');
        			document.getElementById('anomleafType').focus();
        			return false;        			
        		}

        		if(document.getElementById('datepicker4').value == ''){
        			alert('Please select From Date and Time!');
        			document.getElementById('datepicker4').focus();
        			return false;        			
        		}
        		
        		if(document.getElementById('datepicker5').value == ''){
        			alert('Please select To Date and Time!');
        			document.getElementById('datepicker5').focus();
        			return false;        			
        		}
        		
        		if(document.getElementById('anomtimeScale').value == 'select'){
        			alert('Please select Time Scale!');
        			document.getElementById('anomtimeScale').focus();
        			return false;        			
        		}
        	}
        	
        	if(scenarioId == 4){
				if(document.getElementById('sdresearchId').value == 'select'){
        			alert('Please select Research Id!');
        			document.getElementById('sdresearchId').focus();
        			return false;
				        			
				}
				if(document.getElementById('sdgroupId').value == 'select'){
					alert('Please select Group Id!');
					document.getElementById('sdgroupId').focus();
        			return false;
					
				}
				if(document.getElementById('sdsrcId').value == 'select'){
					alert('Please select Source Id!');
					document.getElementById('sdsrcId').focus();
        			return false;
					
				}
        		if(document.getElementById('sdleafValue').value == 'select'){
        			alert('Please select Leaf Value!');
        			document.getElementById('sdleafValue').focus();
        			return false;        			
        		}
        		if(document.getElementById('sdleafType').value == 'select'){
        			alert('Please select Leaf Type!');
        			document.getElementById('sdleafType').focus();
        			return false;        			
        		}

        		if(document.getElementById('datepicker6').value == ''){
        			alert('Please select From Date and Time!');
        			document.getElementById('datepicker').focus();
        			return false;        			
        		}
        		
        		if(document.getElementById('datepicker7').value == ''){
        			alert('Please select To Date and Time!');
        			document.getElementById('datepicker1').focus();
        			return false;        			
        		}
        		
        		if(document.getElementById('sdtimeScale').value == 'select'){
        			alert('Please select Time Scale!');
        			document.getElementById('timeScale').focus();
        			return false;        			
        		}
        		
        	}
        	
        	if(scenarioId == 5){
        		if(document.getElementById('custScript').value == ''){
        			alert('Please enter some R Script!');
        			document.getElementById('custScript').focus();
        			return false;
        		}
        	}
        	
        	return true;
        }
        
		function loadScenario1()
		{		
					var xmlhttp;
					showHidePreloader(true);
					
					if (window.XMLHttpRequest)
					  {// code for IE7+, Firefox, Chrome, Opera, Safari
					  xmlhttp=new XMLHttpRequest();
					  }
					else
					  {// code for IE6, IE5
					  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
					  }
					xmlhttp.onreadystatechange=function()
					  {
					  if (xmlhttp.readyState==4 && xmlhttp.status==200)
					    {
						 showHidePreloader(false);
					     var jsonObjectData1 = JSON.parse(xmlhttp.responseText);		     
					    document.getElementById("imageHold").src="data:image/png;base64,"+jsonObjectData1.lst[1].data;		    
					    }
					  }
					var researchId = document.getElementById('researchId').value;
					if(researchId=='all')
						researchId='';
					var groupId =document.getElementById('groupId').value;
					if(groupId=='all')
						groupId='';
					var srcId = document.getElementById('srcId').value;
					if(srcId=='all')
						srcId='';
					var leafValue = document.getElementById('leafValue').value;
					if(leafValue=='all')
						leafValue='';
					var leafType = document.getElementById('leafType').value;
					if(leafType=='all')
						leafType='';
					var from =document.getElementById('datepicker').value;
					var fromWithoutSpace=from.replace(" ","%20");
					var to = document.getElementById('datepicker1').value;
					var toWithoutSpace = to.replace(" ","%20");
					var timeScale = document.getElementById('timeScale').value;
					var graphType = document.getElementById('analyticsgraphType').value;
					var unit = document.getElementById('analyticsUnit').value;					
					xmlhttp.open("GET","http://"+host+"/msr-ws/api/msr/analytic/graph?researchId="+researchId+"&groupId="+groupId+"&srcId="+srcId+"&leafValue="+
							                       leafValue+"&leafType="+leafType+"&from="+fromWithoutSpace+"&to="+toWithoutSpace+"&timeScale="+timeScale
							                       +"&graphType="+graphType+"&unit="+unit,true);
					xmlhttp.send();
			  		  
		}
		
		function correlation(){
				var xmlhttp;
				showHidePreloader1(true);
				
				if (window.XMLHttpRequest)
				  {// code for IE7+, Firefox, Chrome, Opera, Safari
				  xmlhttp=new XMLHttpRequest();
				  }
				else
				  {// code for IE6, IE5
				  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
				  }
				xmlhttp.onreadystatechange=function()
				  {
				  if (xmlhttp.readyState==4 && xmlhttp.status==200)
				    {
					 showHidePreloader1(false);
				     var jsonObjectData1 = JSON.parse(xmlhttp.responseText);
				    document.getElementById("imageHoldCorrelation").src="data:image/png;base64,"+jsonObjectData1.lst[1].data;	
				    document.getElementById("correlationVal").innerHTML=jsonObjectData1.lst[0].data;
				    }
				  }
				var xresearchId = document.getElementById('xresearchId').value;
				var xgroupId = document.getElementById('xgroupId').value;
				var xsrcId = document.getElementById('xsrcId').value;
				var xleafValue = document.getElementById('xleafValue').value;
				var xleafType = document.getElementById('xleafType').value;
				var yresearchId = document.getElementById('yresearchId').value;
				var ygroupId = document.getElementById('ygroupId').value;
				var ysrcId = document.getElementById('ysrcId').value;
				var yleafValue = document.getElementById('yleafValue').value;
				var yleafType = document.getElementById('yleafType').value;
				var from = document.getElementById('datepicker2').value;
				var fromWithoutSpace = from.replace(" ","%20");
				var to = document.getElementById('datepicker3').value;
				var toWithoutSpace = to.replace(" ","%20");
				var timeScale = document.getElementById('corrtimeScale').value;
				//var graphType = document.getElementById('corrgraphType').value;
				var model = document.getElementById('corrmodel').value;
				var xunit = document.getElementById('xcorrUnit').value;
				var yunit = document.getElementById('ycorrUnit').value;
				
				xmlhttp.open("GET","http://"+host+"/msr-ws/api/msr/correlation?xResearchId="+xresearchId+"&xGroupId="+xgroupId+
						"&xSrcId="+xsrcId+"&xLeafValue="+xleafValue+"&xLeafType="+xleafType+"&yResearchId="+yresearchId+
						"&yGroupId="+ygroupId+"&ySrcId="+ysrcId+"&yLeafValue="+yleafValue+"&yLeafType="+yleafType+
						"&from="+fromWithoutSpace+"&to="+toWithoutSpace+"&timeScale="+timeScale+"&model="+model+"&xunit="+xunit+"&yunit="+yunit,true);
	            xmlhttp.send();
		}
		
		function anamolies(){
				var xmlhttp;
				showHidePreloader3(true);
				
				if (window.XMLHttpRequest)
				  {// code for IE7+, Firefox, Chrome, Opera, Safari
				  xmlhttp=new XMLHttpRequest();
				  }
				else
				  {// code for IE6, IE5
				  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
				  }
				xmlhttp.onreadystatechange=function()
				  {
				  if (xmlhttp.readyState==4 && xmlhttp.status==200)
				    {
					 showHidePreloader3(false);
				     var jsonObjectData1 = JSON.parse(xmlhttp.responseText);
				     
				    document.getElementById("imageHold3").src="data:image/png;base64,"+jsonObjectData1.lst[1].data;
				    document.getElementById("anomVal").innerHTML=jsonObjectData1.lst[0].data;
				    }
				  }
				var researchId = document.getElementById('anomresearchId').value;
				var groupId =document.getElementById('anomgroupId').value;
				var srcId = document.getElementById('anomsrcId').value;
				var leafValue = document.getElementById('anomleafValue').value;
				var leafType = document.getElementById('anomleafType').value;
				var from =document.getElementById('datepicker4').value;
				var fromWithoutSpace=from.replace(" ","%20");
				var to = document.getElementById('datepicker5').value;
				var toWithoutSpace = to.replace(" ","%20");
				var timeScale = document.getElementById('anomtimeScale').value;
				var unit = document.getElementById('anomUnit').value;
				xmlhttp.open("GET","http://"+host+"/msr-ws/api/msr/boundedanomaly?researchId="+researchId+"&groupId="+groupId+"&srcId="+srcId+"&leafValue="+
						                       leafValue+"&leafType="+leafType+"&from="+fromWithoutSpace+"&to="+toWithoutSpace+"&timeScale="+timeScale
						                       +"&unit="+unit,true);
				xmlhttp.send();
		}
		
		function standardDeviation(){
				var xmlhttp;
				showHidePreloader4(true);
				if (window.XMLHttpRequest)
				  {// code for IE7+, Firefox, Chrome, Opera, Safari
				  xmlhttp=new XMLHttpRequest();
				  }
				else
				  {// code for IE6, IE5
				  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
				  }
				xmlhttp.onreadystatechange=function()
				  {
				  if (xmlhttp.readyState==4 && xmlhttp.status==200)
				    {
					 showHidePreloader4(false);
				     var jsonObjectData1 = JSON.parse(xmlhttp.responseText);	
				    document.getElementById("imageHold4").src="data:image/png;base64,"+jsonObjectData1.lst[1].data;
				    document.getElementById("standardDevVal").innerHTML=jsonObjectData1.lst[0].data;
				    }
				  }
				var researchId = document.getElementById('sdresearchId').value;
				var groupId =document.getElementById('sdgroupId').value;
				var srcId = document.getElementById('sdsrcId').value;
				var leafValue = document.getElementById('sdleafValue').value;
				var leafType = document.getElementById('sdleafType').value;
				var from =document.getElementById('datepicker6').value;
				var fromWithoutSpace=from.replace(" ","%20");
				var to = document.getElementById('datepicker7').value;
				var toWithoutSpace = to.replace(" ","%20");
				var timeScale = document.getElementById('sdtimeScale').value;
				var unit = document.getElementById('sdUnit').value;
				var graphType = document.getElementById('sdgraphType').value;
				
				xmlhttp.open("GET","http://"+host+"/msr-ws/api/msr/standardDeviationForDeviceSet?researchId="+researchId+"&groupId="+groupId+"&srcId="+srcId+"&leafValue="+
						                       leafValue+"&leafType="+leafType+"&from="+fromWithoutSpace+"&to="+toWithoutSpace+"&timeScale="+timeScale
						                       +"&graphType="+graphType+"&unit="+unit,true);
				xmlhttp.send();
		}
		
		function customScript(){
			if(validate(5)){
				var xmlhttp;
				showHidePreloader5(true);
				if (window.XMLHttpRequest)
				  {// code for IE7+, Firefox, Chrome, Opera, Safari
				  xmlhttp=new XMLHttpRequest();
				  }
				else
				  {// code for IE6, IE5
				  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
				  }
				xmlhttp.onreadystatechange=function()
				  {
				  if (xmlhttp.readyState==4 && xmlhttp.status==200)
				    {
					  showHidePreloader5(false);
					  var jsonObjectData1 = JSON.parse(xmlhttp.responseText);					  
					  document.getElementById("answer").innerHTML=jsonObjectData1.lst[0].data;					    
				    }
				  }
				  var script = document.getElementById("custScript").value;
				  xmlhttp.open("GET","http://"+host+"/msr-ws/api/msr/runscript?scriptText="+script,true);
				  xmlhttp.send();
			 }
		  }
		
		
		function showHidePreloader(show){
		if(show)
		   document.getElementById('preloader').style.display='block';
		else
		   document.getElementById('preloader').style.display='none';		   
		}

		function showHidePreloader1(show){
			if(show){
			   document.getElementById('preloader1').style.display='block';
			}
			else{
			   document.getElementById('preloader1').style.display='none';
			   document.getElementById('correlationCoefficient').style.display='block';
			}
		}
		
		function showHidePreloader3(show){
			if(show){
			   document.getElementById('preloader3').style.display='block';
			}
			else{
			   document.getElementById('preloader3').style.display='none';
			   document.getElementById('anomalies').style.display='block';
			}
		}
		
		function showHidePreloader4(show){
			if(show){
			   document.getElementById('preloader4').style.display='block';
			}
			else{
			   document.getElementById('preloader4').style.display='none';
			   document.getElementById('standardDeviation').style.display='block';
			}
		}
		
		function showHidePreloader5(show){
			if(show){
			   document.getElementById('preloader5').style.display='block';
			}
			else{
			   document.getElementById('preloader5').style.display='none';
			   document.getElementById("custScriptAns").style.display='block';
			}
		}


		function changeValueOption1(){ 
			var val= document.getElementById("leafType").value;
			if(val=='select'){
				var drp = document.getElementById("leafValue");
				document.getElementById('leafValue').options.length = 0;
				var optn = document.createElement("OPTION"); 
				optn.text="select..";  
				optn.value="select";   
				drp.add(optn);
			}

			if(val==''){
				var drp = document.getElementById("leafValue");
				document.getElementById('leafValue').options.length = 0;
				var optn = document.createElement("OPTION"); 
				optn.text="ALL";  
				optn.value="";   
				drp.add(optn);
			}

			if(val=='deviceType'){
				var drp = document.getElementById("leafValue");
				document.getElementById('leafValue').options.length = 0;
				var optn = document.createElement("OPTION"); 
				optn.text="select..";  
				optn.value="select";   
				drp.add(optn);
				var optn1 = document.createElement("OPTION"); 
				optn1.text="Lights";  
				optn1.value="lights";   
				drp.add(optn1);
				var optn2 = document.createElement("OPTION"); 
				optn2.text="Cooling";  
				optn2.value="cooling";   
				drp.add(optn2);
				var optn3 = document.createElement("OPTION"); 
				optn3.text="Kitchen Appliance";  
				optn3.value="kitchen-appliances";   
				drp.add(optn3);
				var optn4 = document.createElement("OPTION"); 
				optn4.text="Refrigerator";  
				optn4.value="refrigerator";   
				drp.add(optn4);
				var optn5 = document.createElement("OPTION"); 
				optn5.text="Heating";  
				optn5.value="heating";   
				drp.add(optn5);
				var optn6 = document.createElement("OPTION"); 
				optn6.text="Entertainment";  
				optn6.value="entertainment";   
				drp.add(optn6);
				var optn7 = document.createElement("OPTION"); 
				optn7.text="Temperature";  
				optn7.value="temperature";   
				drp.add(optn7);
				var optn8 = document.createElement("OPTION"); 
				optn8.text="Energy Meter";  
				optn8.value="totalec";   
				drp.add(optn8);
				var optn8 = document.createElement("OPTION"); 
				optn8.text="Door";  
				optn8.value="door";   
				drp.add(optn8);
				var optn9 = document.createElement("OPTION"); 
				optn9.text="Heart Monitor";  
				optn9.value="heart-rate-mtr";   
				drp.add(optn9);
			}

			if(val=='deviceId'){
				var drp = document.getElementById("leafValue");
				document.getElementById('leafValue').options.length = 0;
				var optn = document.createElement("OPTION"); 
				optn.text="select..";  
				optn.value="select";   
				drp.add(optn);				
				var optn1 = document.createElement("OPTION"); 
				optn1.text="e01";  
				optn1.value="e01";   
				drp.add(optn1);
				var optn2 = document.createElement("OPTION"); 
				optn2.text="e02";  
				optn2.value="e02";   
				drp.add(optn2);
				var optn3 = document.createElement("OPTION"); 
				optn3.text="e03";  
				optn3.value="e03";   
				drp.add(optn3);
				var optn4 = document.createElement("OPTION"); 
				optn4.text="e03";  
				optn4.value="e03";   
				drp.add(optn4);
				var optn5 = document.createElement("OPTION"); 
				optn5.text="e04";  
				optn5.value="e04";   
				drp.add(optn5);
				var optn6 = document.createElement("OPTION"); 
				optn6.text="e05";  
				optn6.value="e05";   
				drp.add(optn6);
				var optn7 = document.createElement("OPTION"); 
				optn7.text="e06";  
				optn7.value="e06";   
				drp.add(optn7);
				var optn8 = document.createElement("OPTION"); 
				optn8.text="deg000";  
				optn8.value="deg000";   
				drp.add(optn8);
				var optn9 = document.createElement("OPTION"); 
				optn9.text="e0000";  
				optn9.value="e0000";   
				drp.add(optn9);
				var optn10 = document.createElement("OPTION"); 
				optn10.text="f01";  
				optn10.value="f01";   
				drp.add(optn10);
				var optn11 = document.createElement("OPTION"); 
				optn11.text="hrm00";  
				optn11.value="hrm00";   
				drp.add(optn11);
			}
			if(val=='location'){
				var drp = document.getElementById("leafValue");
				document.getElementById('leafValue').options.length = 0;
				var optn = document.createElement("OPTION"); 
				optn.text="select..";  
				optn.value="select";   
				drp.add(optn);
				var optn1 = document.createElement("OPTION"); 
				optn1.text="Miami";  
				optn1.value="Miami";   
				drp.add(optn1);	
				var optn2 = document.createElement("OPTION"); 
				optn2.text="Leicester";  
				optn2.value="Leicester";   
				drp.add(optn2);
				var optn3 = document.createElement("OPTION"); 
				optn3.text="London";  
				optn3.value="London";   
				drp.add(optn3);	
			}
		}

		function changeValueOption2(){ 
			var val= document.getElementById("xleafType").value;
			if(val=='select'){
				var drp = document.getElementById("xleafValue");
				document.getElementById('xleafValue').options.length = 0;
				var optn = document.createElement("OPTION"); 
				optn.text="select..";  
				optn.value="select";   
				drp.add(optn);
			}

			if(val==''){
				var drp = document.getElementById("xleafValue");
				document.getElementById('xleafValue').options.length = 0;
				var optn = document.createElement("OPTION"); 
				optn.text="ALL";  
				optn.value="";   
				drp.add(optn);
			}
			
			if(val=='deviceType'){
				var drp = document.getElementById("xleafValue");
				document.getElementById('xleafValue').options.length = 0;
				var optn = document.createElement("OPTION"); 
				optn.text="select..";  
				optn.value="select";   
				drp.add(optn);
				var optn1 = document.createElement("OPTION"); 
				optn1.text="Lights";  
				optn1.value="lights";   
				drp.add(optn1);
				var optn2 = document.createElement("OPTION"); 
				optn2.text="Cooling";  
				optn2.value="cooling";   
				drp.add(optn2);
				var optn3 = document.createElement("OPTION"); 
				optn3.text="Kitchen Appliance";  
				optn3.value="kitchen-appliances";   
				drp.add(optn3);
				var optn4 = document.createElement("OPTION"); 
				optn4.text="Refrigerator";  
				optn4.value="refrigerator";   
				drp.add(optn4);
				var optn5 = document.createElement("OPTION"); 
				optn5.text="Heating";  
				optn5.value="heating";   
				drp.add(optn5);
				var optn6 = document.createElement("OPTION"); 
				optn6.text="Entertainment";  
				optn6.value="entertainment";   
				drp.add(optn6);
				var optn7 = document.createElement("OPTION"); 
				optn7.text="Temperature";  
				optn7.value="temperature";   
				drp.add(optn7);
				var optn8 = document.createElement("OPTION"); 
				optn8.text="Energy Meter";  
				optn8.value="totalec";   
				drp.add(optn8);
				var optn8 = document.createElement("OPTION"); 
				optn8.text="Door";  
				optn8.value="door";   
				drp.add(optn8);
				var optn9 = document.createElement("OPTION"); 
				optn9.text="Heart Monitor";  
				optn9.value="heart-rate-mtr";   
				drp.add(optn9);
			}

			if(val=='deviceId'){
				var drp = document.getElementById("xleafValue");
				document.getElementById('xleafValue').options.length = 0;
				var optn = document.createElement("OPTION"); 
				optn.text="select..";  
				optn.value="select";   
				drp.add(optn);				
				var optn1 = document.createElement("OPTION"); 
				optn1.text="e01";  
				optn1.value="e01";   
				drp.add(optn1);
				var optn2 = document.createElement("OPTION"); 
				optn2.text="e02";  
				optn2.value="e02";   
				drp.add(optn2);
				var optn3 = document.createElement("OPTION"); 
				optn3.text="e03";  
				optn3.value="e03";   
				drp.add(optn3);
				var optn4 = document.createElement("OPTION"); 
				optn4.text="e03";  
				optn4.value="e03";   
				drp.add(optn4);
				var optn5 = document.createElement("OPTION"); 
				optn5.text="e04";  
				optn5.value="e04";   
				drp.add(optn5);
				var optn6 = document.createElement("OPTION"); 
				optn6.text="e05";  
				optn6.value="e05";   
				drp.add(optn6);
				var optn7 = document.createElement("OPTION"); 
				optn7.text="e06";  
				optn7.value="e06";   
				drp.add(optn7);
				var optn8 = document.createElement("OPTION"); 
				optn8.text="deg000";  
				optn8.value="deg000";   
				drp.add(optn8);
				var optn9 = document.createElement("OPTION"); 
				optn9.text="e0000";  
				optn9.value="e0000";   
				drp.add(optn9);
				var optn10 = document.createElement("OPTION"); 
				optn10.text="f01";  
				optn10.value="f01";   
				drp.add(optn10);
				var optn11 = document.createElement("OPTION"); 
				optn11.text="hrm00";  
				optn11.value="hrm00";   
				drp.add(optn11);
			}
			if(val=='location'){
				var drp = document.getElementById("xleafValue");
				document.getElementById('xleafValue').options.length = 0;
				var optn = document.createElement("OPTION"); 
				optn.text="select..";  
				optn.value="select";   
				drp.add(optn);
				var optn1 = document.createElement("OPTION"); 
				optn1.text="Miami";  
				optn1.value="Miami";   
				drp.add(optn1);	
				var optn2 = document.createElement("OPTION"); 
				optn2.text="Leicester";  
				optn2.value="Leicester";   
				drp.add(optn2);
				var optn3 = document.createElement("OPTION"); 
				optn3.text="London";  
				optn3.value="London";   
				drp.add(optn3);	
			}
		}

		function changeValueOption3(){ 
			var val= document.getElementById("yleafType").value;
			if(val=='select'){
				var drp = document.getElementById("yleafValue");
				document.getElementById('yleafValue').options.length = 0;
				var optn = document.createElement("OPTION"); 
				optn.text="select..";  
				optn.value="select";   
				drp.add(optn);
			}

			if(val==''){
				var drp = document.getElementById("yleafValue");
				document.getElementById('yleafValue').options.length = 0;
				var optn = document.createElement("OPTION"); 
				optn.text="ALL";  
				optn.value="";   
				drp.add(optn);
			}

			if(val=='deviceType'){
				var drp = document.getElementById("yleafValue");
				document.getElementById('yleafValue').options.length = 0;
				var optn = document.createElement("OPTION"); 
				optn.text="select..";  
				optn.value="select";   
				drp.add(optn);
				var optn1 = document.createElement("OPTION"); 
				optn1.text="Lights";  
				optn1.value="lights";   
				drp.add(optn1);
				var optn2 = document.createElement("OPTION"); 
				optn2.text="Cooling";  
				optn2.value="cooling";   
				drp.add(optn2);
				var optn3 = document.createElement("OPTION"); 
				optn3.text="Kitchen Appliance";  
				optn3.value="kitchen-appliances";   
				drp.add(optn3);
				var optn4 = document.createElement("OPTION"); 
				optn4.text="Refrigerator";  
				optn4.value="refrigerator";   
				drp.add(optn4);
				var optn5 = document.createElement("OPTION"); 
				optn5.text="Heating";  
				optn5.value="heating";   
				drp.add(optn5);
				var optn6 = document.createElement("OPTION"); 
				optn6.text="Entertainment";  
				optn6.value="entertainment";   
				drp.add(optn6);
				var optn7 = document.createElement("OPTION"); 
				optn7.text="Temperature";  
				optn7.value="temperature";   
				drp.add(optn7);
				var optn8 = document.createElement("OPTION"); 
				optn8.text="Energy Meter";  
				optn8.value="totalec";   
				drp.add(optn8);
				var optn8 = document.createElement("OPTION"); 
				optn8.text="Door";  
				optn8.value="door";   
				drp.add(optn8);
				var optn9 = document.createElement("OPTION"); 
				optn9.text="Heart Monitor";  
				optn9.value="heart-rate-mtr";   
				drp.add(optn9);
			}

			if(val=='deviceId'){
				var drp = document.getElementById("yleafValue");
				document.getElementById('yleafValue').options.length = 0;
				var optn = document.createElement("OPTION"); 
				optn.text="select..";  
				optn.value="select";   
				drp.add(optn);				
				var optn1 = document.createElement("OPTION"); 
				optn1.text="e01";  
				optn1.value="e01";   
				drp.add(optn1);
				var optn2 = document.createElement("OPTION"); 
				optn2.text="e02";  
				optn2.value="e02";   
				drp.add(optn2);
				var optn3 = document.createElement("OPTION"); 
				optn3.text="e03";  
				optn3.value="e03";   
				drp.add(optn3);
				var optn4 = document.createElement("OPTION"); 
				optn4.text="e03";  
				optn4.value="e03";   
				drp.add(optn4);
				var optn5 = document.createElement("OPTION"); 
				optn5.text="e04";  
				optn5.value="e04";   
				drp.add(optn5);
				var optn6 = document.createElement("OPTION"); 
				optn6.text="e05";  
				optn6.value="e05";   
				drp.add(optn6);
				var optn7 = document.createElement("OPTION"); 
				optn7.text="e06";  
				optn7.value="e06";   
				drp.add(optn7);
				var optn8 = document.createElement("OPTION"); 
				optn8.text="deg000";  
				optn8.value="deg000";   
				drp.add(optn8);
				var optn9 = document.createElement("OPTION"); 
				optn9.text="e0000";  
				optn9.value="e0000";   
				drp.add(optn9);
				var optn10 = document.createElement("OPTION"); 
				optn10.text="f01";  
				optn10.value="f01";   
				drp.add(optn10);
				var optn11 = document.createElement("OPTION"); 
				optn11.text="hrm00";  
				optn11.value="hrm00";   
				drp.add(optn11);
			}
			if(val=='location'){
				var drp = document.getElementById("yleafValue");
				document.getElementById('yleafValue').options.length = 0;
				var optn = document.createElement("OPTION"); 
				optn.text="select..";  
				optn.value="select";   
				drp.add(optn);
				var optn1 = document.createElement("OPTION"); 
				optn1.text="Miami";  
				optn1.value="Miami";   
				drp.add(optn1);	
				var optn2 = document.createElement("OPTION"); 
				optn2.text="Leicester";  
				optn2.value="Leicester";   
				drp.add(optn2);
				var optn3 = document.createElement("OPTION"); 
				optn3.text="London";  
				optn3.value="London";   
				drp.add(optn3);	
			}
		}

		function changeValueOption4(){ 
			var val= document.getElementById("anomleafType").value;
			if(val=='select'){
				var drp = document.getElementById("anomleafValue");
				document.getElementById('anomleafValue').options.length = 0;
				var optn = document.createElement("OPTION"); 
				optn.text="select..";  
				optn.value="select";   
				drp.add(optn);
			}

			if(val==''){
				var drp = document.getElementById("anomleafValue");
				document.getElementById('anomleafValue').options.length = 0;
				var optn = document.createElement("OPTION"); 
				optn.text="ALL";  
				optn.value="";   
				drp.add(optn);
			}

			if(val=='deviceType'){
				var drp = document.getElementById("anomleafValue");
				document.getElementById('anomleafValue').options.length = 0;
				var optn = document.createElement("OPTION"); 
				optn.text="select..";  
				optn.value="select";   
				drp.add(optn);
				var optn1 = document.createElement("OPTION"); 
				optn1.text="Lights";  
				optn1.value="lights";   
				drp.add(optn1);
				var optn2 = document.createElement("OPTION"); 
				optn2.text="Cooling";  
				optn2.value="cooling";   
				drp.add(optn2);
				var optn3 = document.createElement("OPTION"); 
				optn3.text="Kitchen Appliance";  
				optn3.value="kitchen-appliances";   
				drp.add(optn3);
				var optn4 = document.createElement("OPTION"); 
				optn4.text="Refrigerator";  
				optn4.value="refrigerator";   
				drp.add(optn4);
				var optn5 = document.createElement("OPTION"); 
				optn5.text="Heating";  
				optn5.value="heating";   
				drp.add(optn5);
				var optn6 = document.createElement("OPTION"); 
				optn6.text="Entertainment";  
				optn6.value="entertainment";   
				drp.add(optn6);
				var optn7 = document.createElement("OPTION"); 
				optn7.text="Temperature";  
				optn7.value="temperature";   
				drp.add(optn7);
				var optn8 = document.createElement("OPTION"); 
				optn8.text="Energy Meter";  
				optn8.value="totalec";   
				drp.add(optn8);
				var optn8 = document.createElement("OPTION"); 
				optn8.text="Door";  
				optn8.value="door";   
				drp.add(optn8);
				var optn9 = document.createElement("OPTION"); 
				optn9.text="Heart Monitor";  
				optn9.value="heart-rate-mtr";   
				drp.add(optn9);
			}

			if(val=='deviceId'){
				var drp = document.getElementById("anomleafValue");
				document.getElementById('anomleafValue').options.length = 0;
				var optn = document.createElement("OPTION"); 
				optn.text="select..";  
				optn.value="select";   
				drp.add(optn);				
				var optn1 = document.createElement("OPTION"); 
				optn1.text="e01";  
				optn1.value="e01";   
				drp.add(optn1);
				var optn2 = document.createElement("OPTION"); 
				optn2.text="e02";  
				optn2.value="e02";   
				drp.add(optn2);
				var optn3 = document.createElement("OPTION"); 
				optn3.text="e03";  
				optn3.value="e03";   
				drp.add(optn3);
				var optn4 = document.createElement("OPTION"); 
				optn4.text="e03";  
				optn4.value="e03";   
				drp.add(optn4);
				var optn5 = document.createElement("OPTION"); 
				optn5.text="e04";  
				optn5.value="e04";   
				drp.add(optn5);
				var optn6 = document.createElement("OPTION"); 
				optn6.text="e05";  
				optn6.value="e05";   
				drp.add(optn6);
				var optn7 = document.createElement("OPTION"); 
				optn7.text="e06";  
				optn7.value="e06";   
				drp.add(optn7);
				var optn8 = document.createElement("OPTION"); 
				optn8.text="deg000";  
				optn8.value="deg000";   
				drp.add(optn8);
				var optn9 = document.createElement("OPTION"); 
				optn9.text="e0000";  
				optn9.value="e0000";   
				drp.add(optn9);
				var optn10 = document.createElement("OPTION"); 
				optn10.text="f01";  
				optn10.value="f01";   
				drp.add(optn10);
				var optn11 = document.createElement("OPTION"); 
				optn11.text="hrm00";  
				optn11.value="hrm00";   
				drp.add(optn11);
			}
			if(val=='location'){
				var drp = document.getElementById("anomleafValue");
				document.getElementById('anomleafValue').options.length = 0;
				var optn = document.createElement("OPTION"); 
				optn.text="select..";  
				optn.value="select";   
				drp.add(optn);
				var optn1 = document.createElement("OPTION"); 
				optn1.text="Miami";  
				optn1.value="Miami";   
				drp.add(optn1);	
				var optn2 = document.createElement("OPTION"); 
				optn2.text="Leicester";  
				optn2.value="Leicester";   
				drp.add(optn2);
				var optn3 = document.createElement("OPTION"); 
				optn3.text="London";  
				optn3.value="London";   
				drp.add(optn3);	
			}
		}

		function changeValueOption5(){ 
			var val= document.getElementById("sdleafType").value;
			if(val=='select'){
				var drp = document.getElementById("sdleafValue");
				document.getElementById('sdleafValue').options.length = 0;
				var optn = document.createElement("OPTION"); 
				optn.text="select..";  
				optn.value="select";   
				drp.add(optn);
			}

			if(val==''){
				var drp = document.getElementById("sdleafValue");
				document.getElementById('sdleafValue').options.length = 0;
				var optn = document.createElement("OPTION"); 
				optn.text="ALL";  
				optn.value="";   
				drp.add(optn);
			}

			if(val=='deviceType'){
				var drp = document.getElementById("sdleafValue");
				document.getElementById('sdleafValue').options.length = 0;
				var optn = document.createElement("OPTION"); 
				optn.text="select..";  
				optn.value="select";   
				drp.add(optn);
				var optn1 = document.createElement("OPTION"); 
				optn1.text="Lights";  
				optn1.value="lights";   
				drp.add(optn1);
				var optn2 = document.createElement("OPTION"); 
				optn2.text="Cooling";  
				optn2.value="cooling";   
				drp.add(optn2);
				var optn3 = document.createElement("OPTION"); 
				optn3.text="Kitchen Appliance";  
				optn3.value="kitchen-appliances";   
				drp.add(optn3);
				var optn4 = document.createElement("OPTION"); 
				optn4.text="Refrigerator";  
				optn4.value="refrigerator";   
				drp.add(optn4);
				var optn5 = document.createElement("OPTION"); 
				optn5.text="Heating";  
				optn5.value="heating";   
				drp.add(optn5);
				var optn6 = document.createElement("OPTION"); 
				optn6.text="Entertainment";  
				optn6.value="entertainment";   
				drp.add(optn6);
				var optn7 = document.createElement("OPTION"); 
				optn7.text="Temperature";  
				optn7.value="temperature";   
				drp.add(optn7);
				var optn8 = document.createElement("OPTION"); 
				optn8.text="Energy Meter";  
				optn8.value="totalec";   
				drp.add(optn8);
				var optn8 = document.createElement("OPTION"); 
				optn8.text="Door";  
				optn8.value="door";   
				drp.add(optn8);
				var optn9 = document.createElement("OPTION"); 
				optn9.text="Heart Monitor";  
				optn9.value="heart-rate-mtr";   
				drp.add(optn9);
			}

			if(val=='deviceId'){
				var drp = document.getElementById("sdleafValue");
				document.getElementById('sdleafValue').options.length = 0;
				var optn = document.createElement("OPTION"); 
				optn.text="select..";  
				optn.value="select";   
				drp.add(optn);				
				var optn1 = document.createElement("OPTION"); 
				optn1.text="e01";  
				optn1.value="e01";   
				drp.add(optn1);
				var optn2 = document.createElement("OPTION"); 
				optn2.text="e02";  
				optn2.value="e02";   
				drp.add(optn2);
				var optn3 = document.createElement("OPTION"); 
				optn3.text="e03";  
				optn3.value="e03";   
				drp.add(optn3);
				var optn4 = document.createElement("OPTION"); 
				optn4.text="e03";  
				optn4.value="e03";   
				drp.add(optn4);
				var optn5 = document.createElement("OPTION"); 
				optn5.text="e04";  
				optn5.value="e04";   
				drp.add(optn5);
				var optn6 = document.createElement("OPTION"); 
				optn6.text="e05";  
				optn6.value="e05";   
				drp.add(optn6);
				var optn7 = document.createElement("OPTION"); 
				optn7.text="e06";  
				optn7.value="e06";   
				drp.add(optn7);
				var optn8 = document.createElement("OPTION"); 
				optn8.text="deg000";  
				optn8.value="deg000";   
				drp.add(optn8);
				var optn9 = document.createElement("OPTION"); 
				optn9.text="e0000";  
				optn9.value="e0000";   
				drp.add(optn9);
				var optn10 = document.createElement("OPTION"); 
				optn10.text="f01";  
				optn10.value="f01";   
				drp.add(optn10);
				var optn11 = document.createElement("OPTION"); 
				optn11.text="hrm00";  
				optn11.value="hrm00";   
				drp.add(optn11);
			}
			if(val=='location'){
				var drp = document.getElementById("sdleafValue");
				document.getElementById('sdleafValue').options.length = 0;
				var optn = document.createElement("OPTION"); 
				optn.text="select..";  
				optn.value="select";   
				drp.add(optn);
				var optn1 = document.createElement("OPTION"); 
				optn1.text="Miami";  
				optn1.value="Miami";   
				drp.add(optn1);	
				var optn2 = document.createElement("OPTION"); 
				optn2.text="Leicester";  
				optn2.value="Leicester";   
				drp.add(optn2);
				var optn3 = document.createElement("OPTION"); 
				optn3.text="London";  
				optn3.value="London";   
				drp.add(optn3);	
			}
		}
</script>
</head>
<body>
<div id="container">
		<div id="header">
        	<h1><img border="0" src="<%=request.getContextPath()%>/images/Lot.jpg" alt="Lab of Things"</h1>
            <h2>Lab of Things Analytics Engine</h2>
        </div>   
        
        <div id="menu">
        	<ul>
            	<li class="menuitem"><a href="#" onClick="showScenarioDiv(6);">Home</a></li>
                <li class="menuitem"><a href="#" onClick="showScenarioDiv(9)">About</a></li>
                <li class="menuitem"><a href="#" onClick="showScenarioDiv(8);">Design</a></li>
                <li class="menuitem"><a href="#" onClick="showScenarioDiv(7);">Contact</a></li>
            </ul>
        </div>
        
        <div id="leftmenu">

        <div id="leftmenu_top"></div>
				<div id="leftmenu_main">                  
	                <h3>Options</h3>	                        
	                <ul>
	                    <li><a href="#" onClick="showScenarioDiv(1);">Analytic Graph</a></li>
	                    <li><a href="#" onClick="showScenarioDiv(2);">Correlation</a></li>	                   
	                    <li><a href="#" onClick="showScenarioDiv(3);">Anomalies</a></li>
	                     <li><a href="#" onClick="showScenarioDiv(4);">Standard Deviation</a></li>
	                    <li><a href="#" onClick="showScenarioDiv(5);">Custom Script</a></li>	                                        
	                </ul>
				</div>               
              <div id="leftmenu_bottom"></div>
        </div>        
		<div id="content">        
             <div id="content_top"></div>
	        <div id="content_main">
	            <div class="box-in" id="home_welcome" style="display:block;">
		              <br />
		              <b><p>Welcome to the Lab of Things Analytics Web Portal</p></b>
		              <br />
		              <p>Microsoft Research has embarked on a development project to enhance HomeOS which is currently in Version 1.0. The next planned version will be release in mid-July which will introduce an open platform for research in devices and services on the cloud (tentatively called HomeLab). The enhanced platform includes a number of additional features such as remote monitoring, sample apps, support for additional devices, etc.</p> 
						<br />
						<p>Our team is going to work on the kernel of the system and will build on existing ideas in analysing data collected on home automation. We will specifically design a Big Data API for collecting and disseminating results for the HomeOS data collection. Due to the fact that our team currently does not have a Big Data collection, we have defined three strategies to simulate Big Data collection. Once this collection is in place, we intend to come up with interesting analytics that may add business value to home automation.</p>
	                    <br/>
	                  <p>Our work will provide global access to research findings. The main aim is to create analytics that redefine home automation. We hope for a potential adoption of our work by Microsoft Research.</p>	                
	            <br />
	            </div>
	            <div class="box-in" id="home_contact" style="display:none;">
		             <br/> <p>This website was developed as part of a research project at <i>University College London</i> in September, 2013</p>
		              <br/><b><p>Developers:</p></b><br/>
		              <p><i>Sambodhi Khandelwal</i></p>
		              <p><i>Chirag Misra</i></p>
		              <p><i>Georgios Demirtsoglou</i></p>
		              <p><i>Hee San Kim</i></p>    
		            <br/>
		            
		           <b><p>Project Supervisor</p></b><br/>
		            <p><i>Dr. Dean Mohamedally</i></p>
		            <br/>
		            <p>The code for the analytics engine supporting this website can be found at Codeplex.<br/> Please follow the link at the bottom of this page.</p>
		            <br/>
	            </div>
	            <div class="box-in" id="home_design" style="display:none;">	
	               <br/><p>Our architecture is designed adopting a tiered approach which enabled us to implement the Analytic Engine to manage the complexity of the system by dividing the responsibilities to multiple tiers, making each tier specialized for certain kind of work, making the system more maintainable and scalable.</p>  
	               <br/><p>The architecture targets three design points as illustrated in the figure below:</p>            
                  <br/> <img src=""></img>
                  <br/><br/>
	            </div>
	             <div class="box-in" id="home_about" style="display:none;">
	                <br/><b><p>Introduction</p></b>
	                <br/><p>
						Home automation is defined as the use of one or more computers using software to control basic home functions and features automatically and sometimes remotely. An automated home is sometimes called a smart home. There are a number of open source and proprietary platforms which enable home automation. Microsoft Research has developed one such open platform called HomeOS. There are a number of other similar platforms in the market. One commonality we found among all these home automation platform was the lack of a component to analyze the data received (or which potentially could be extracted) from the devices they control. Some of these open platforms have gone to the extent of providing a means to collect data and store it but there is no way to analyze or make sense of this data.</p>
					<br/>	<p>We believe that there is a gap in the market when it comes to analyzing data collected from devices deployed in homes and other locations such as hospitals, gyms, schools. We call for the development of an Analytics Engine which provides an API for systems such as HomeOS to connect and send device data for analysis. Microsoft Research have introduced a centralized platform to collect data from different homes running HomeOS called Lab of Things (LoT). During the course of this project we have developed an Analytics Engine which is capable of collecting data from sources such as LoT, analyzing it and creating visualizations for this data.
	                </p>
	                <br/><b><p>Objective</p></b>
					<br/><p>Our work will provide an Analytics Engine to collect data from a range of devices, via HomeOS/LoT and similar platforms, for a wide scope of use cases and provide analysis over this data to identify usage patterns and compare data from different research groups.</p> 
	                <br/>	             
	             </div> 
	        	<div class="box-in" id="scenario1Div" style="display:none;">
	        	     <table>
	        	     <tr>
	        	     <table>
	        	       <tr>
	        	         <td>
	        	         
	        	         </td>
	        	         <td>
	        	         
	        	         </td>
	        	         <td nowrap>
	        	           <br/><h4>Analytics Graph</h4><br/>
	        	         </td>
	        	       </tr>
	        	       <tr >
	        	         <td>
	        	             Research Id:
	        	         </td>
	        	         <td>
	        	            <select id="researchId">
	        	               <option value="select">select</option>
	        	               <option value="">ALL</option>
	        	               <option value="Ucl">UCL</option>
							   <option value="MS-R1">MS-R1</option>
							   <option value="MS-R2">MS-R2</option>
							   <option value="MS-R3">MS-R3</option>
	        	            </select>
	        	         </td>
	        	         <td>
	        	           Group Id:
	        	         </td>	
	        	         <td>
	        	            <select id="groupId">
	        	               <option value="select">select</option>
	        	               <option value="">ALL</option>
	        	               <option value="hospital">hospital</option>
							   <option value="home">Home</option>
	        	            </select>
	        	         </td>
	        	         <td>
	        	           Source Id:
	        	         </td>
	        	         <td>
	        	            <select id="srcId">
	        	               <option value="select">select</option>
	        	               <option value="">ALL</option>
	        	               <option value="12300">12300</option>
	        	               <option value="12311">12311</option>
	        	               <option value="12322">12322</option>
	        	               <option value="12333">12333</option>
	        	               <option value="12344">12344</option>
	        	            </select>
	        	         </td>        	         	        	         
	        	       </tr>
	        	       <tr>
	        	         <td>
	        	          Category Type:	        	         
	        	         </td>
	        	         <td>
	        	           <select id="leafType" onchange="changeValueOption1();">
	        	               <option value="">select</option>
	        	               <option value="">ALL</option>
	        	               <option value="deviceType">Device Type</option>
	        	               <option value="deviceId">Device Id</option>
	        	               <option value="location">Location</option>
	        	            </select>	        	         
	        	         </td>
	        	         <td>
	        	           Category Value:
	        	         </td>
	        	         <td>
	        	           <select id="leafValue">
	        	               <option value="">select</option>	        	               
	        	            </select>
	        	         </td>
	        	         <td>
	        	           Graph Type:
	        	         </td>	        	         
	        	         <td>
	        	            <select id="analyticsgraphType">
	        	               <option value="">select</option>
	        	               <option value="p">Point</option>
	        	               <option value="l">Line</option>
	        	               <option value="b">Point & Line</option>
	        	               <option value="h">Histogram</option>										   
	        	            </select>
	        	         </td>	        	         
	        	       </tr>
	        	       <tr>
	        	         <td>
	        	           From:
	        	         </td>
	        	         <td>
	        	           <input type="text" id="datepicker" size="12" />
	        	         </td>
	        	         <td>
	        	           To:
	        	         </td> 
	        	         <td>
	        	           <input type="text" id="datepicker1" size="12" />
	        	         </td>
	        	         <td>
	        	           Time Scale:
	        	         </td>
	        	         <td>
	        	            <select id="timeScale">
	        	               <option value="">select</option>
	        	               <option value="hourly">Hourly</option>
							   <option value="weekly">Weekly</option>
							   <option value="monthly">Monthly</option>
							   <option value="annually">Annually</option>
	        	            </select>
	        	         </td>	        	        	        	        
	        	       </tr>
	        	       <tr>
	        	         <td>
	        	           Unit:
	        	         </td>	        	         
	        	         <td>
	        	            <select id="analyticsUnit">
	        	               <option value="">select</option>
	        	               <option value="hrm">Heart Rate</option>
	        	               <option value="f">Frequency</option>
	        	               <option value="e">Electricity Consumption</option>
	        	               <option value="deg">Degree</option>										   
	        	            </select>
	        	         </td>
	        	       </tr>	        	       
	        	       <tr>
	        	          <td>
	        	            <br/><button type="button" onclick="loadScenario1();">Submit</button>
	        	         </td>
	        	         <td>
	        	          <br/><button type="button" onclick="preselectedValues(1);">Pre-Selected Scenario</button>
	        	         </td>
	        	       </tr>	
	        	      </table>
	        	      </tr>
	        	      <tr>
	        	      <table>
	        	       <tr>
	        	          <td id="preloader" style="display:none;"><img src="http://preloaders.net/images/ajax-loader.gif" /></td>	                
	                      <td><img id="imageHold"/></td>
	        	       </tr>        	      
	        	     </table>
	                 </tr>
	                 </table>	                 
	            </div>
	        	<div class="box-in" id="scenario2Div" style="display:none;">
	        	    <table>
	        	    <tr>
	        	    <table>
	        	       <tr>
	        	         <td>
	        	         
	        	         </td>
	        	         <td>
	        	         
	        	         </td>
	        	         <td nowrap>
	        	           <br/>&nbsp;&nbsp;&nbsp;<h4>Correlation</h4><br/>
	        	         </td>
	        	         <td> </td>
	        	         <td> </td>
	        	         <td> </td>
	        	         <td> </td>
	        	       </tr>
	        	       <tr>
	        	         <td nowrap>
	        	            xResearch Id:
	        	         </td>
	        	         <td>
	        	            <select id="xresearchId">
	        	               <option value="select">select</option>
	        	               <option value="">ALL</option>
	        	               <option value="Ucl">UCL</option>
	        	               <option value="MS-R1">MS-R1</option>
	        	               <option value="MS-R2">MS-R2</option>
	        	               <option value="MS-R3">MS-R3</option>
	        	            </select>
	        	         </td>
	        	         <td nowrap>
	        	           xGroup Id:
	        	         </td>	
	        	         <td>
	        	            <select id="xgroupId">
	        	               <option value="select">select</option>
	        	               <option value="">ALL</option>
	        	               <option value="hospital">Hospital</option>
							   <option value="home">Home</option>
	        	            </select>
	        	         </td>
	        	         <td nowrap>
	        	           xSource Id:
	        	         </td>
	        	         <td>
	        	            <select id="xsrcId">
	        	               <option value="select">select</option>
	        	               <option value="">ALL</option>
	        	               <option value="12300">12300</option>
	        	               <option value="12311">12311</option>
	        	               <option value="12322">12322</option>
	        	               <option value="12333">12333</option>
	        	               <option value="12344">12344</option>
	        	            </select>
	        	         </td>
	        	         <td></td>
	        	         <td></td>        	         
	        	         </tr>
	        	         <tr>
	        	           <td nowrap>
	        	            yResearch Id:
	        	         </td>
	        	         <td>
	        	            <select id="yresearchId">
	        	               <option value="select">select</option>
	        	               <option value="">ALL</option>
	        	               <option value="Ucl">UCL</option>
	        	               <option value="MS-R1">MS-R1</option>
	        	               <option value="MS-R2">MS-R2</option>
	        	               <option value="MS-R3">MS-R3</option>
	        	            </select>
	        	         </td>
	        	         <td nowrap>
	        	           yGroup Id:
	        	         </td>	
	        	         <td>
	        	            <select id="ygroupId">
	        	               <option value="select">select</option>
	        	               <option value="">ALL</option>
	        	               <option value="hospital">Hospital</option>
							   <option value="home">Home</option>
	        	            </select>
	        	         </td>
	        	         <td nowrap>
	        	           ySource Id:
	        	         </td>
	        	         <td>
	        	            <select id="ysrcId">
	        	               <option value="select">select</option>
	        	               <option value="">ALL</option>
	        	              <option value="12300">12300</option>
	        	               <option value="12311">12311</option>
	        	               <option value="12322">12322</option>
	        	               <option value="12333">12333</option>
	        	               <option value="12344">12344</option>
	        	            </select>
	        	         </td>
	        	         <td></td>
	        	         <td></td>  
	        	         </tr>
	        	         <tr>
	        	         <td nowrap>	        	         
	        	          xCategory Type:	        	         
	        	         </td>
	        	         <td>
	        	           <select id="xleafType" onchange="changeValueOption2()">
	        	               <option value="select">select</option>
	        	               <option value="">ALL</option>
	        	               <option value="deviceType">Device Type</option>
							   <option value="deviceId">Device Id</option>
							   <option value="location">Location</option>
	        	            </select>	        	         
	        	         </td>     	       
	        	         <td nowrap>
	        	           xCategory Value:
	        	         </td>
	        	         <td>
	        	           <select id="xleafValue">
	        	               <option value="select">select</option>	        	               
	        	            </select>
	        	         </td>  	         
	        	         </tr>
	        	         <tr>
	        	         <td nowrap>	        	         
	        	          yCategory Type:	        	         
	        	         </td>
	        	         <td>
	        	           <select id="yleafType" onchange="changeValueOption3()">
	        	               <option value="select">select</option>
	        	               <option value="">ALL</option>
	        	                <option value="deviceType">Device Type</option>
							   <option value="deviceId">Device Id</option>
							   <option value="location">Location</option>
	        	            </select>	        	         
	        	         </td>
	        	         <td nowrap>
	        	           yCategory Value:
	        	         </td>
	        	         <td>
	        	           <select id="yleafValue">
	        	               <option value="select">select</option>	        	               
	        	            </select>
	        	         </td>	        	         
	        	       </tr>	        	      
	        	       <tr>	        	         
	        	         <td nowrap>
	        	          Time Scale:
	        	         </td>
	        	         <td>
	        	            <select id="corrtimeScale">
	        	               <option value="select">select</option>
	        	               <option value="hourly">Hourly</option>
							   <option value="weekly">Weekly</option>
							   <option value="monthly">Monthly</option>
							   <option value="annually">Annually</option>
	        	            </select>
	        	         </td>	        	         
	        	         <td nowrap>
	        	           Model:
	        	         </td>
	        	         <td>
	        	            <select id="corrmodel">
	        	               <option value="select">select</option>
	        	               <option value="kendall">Kendall</option>
	        	               <option value="pearson">Pearson</option>	
	        	               <option value="spearman">Spearman</option>	
	        	               					   
	        	            </select>
	        	         </td> 	        	                 	        	        	        
	        	       </tr>	        	       
	        	       <tr>	        	          
	        	          <td nowrap>
	        	           From:
	        	         </td>
	        	         <td align="left">
	        	           <input type="text" id="datepicker2" size="12" />
	        	         </td>
	        	         <td nowrap>
	        	           To:
	        	         </td> 
	        	         <td>
	        	           <input type="text" id="datepicker3" size="12" />
	        	         </td>
	        	         <td> </td>
	        	         <td> </td>   	         
	        	         <td> </td>
	        	         <td> </td>
	        	       </tr>
	        	       <tr>
	        	         <td>
	        	           xUnit:
	        	         </td>
	        	         <td>
	        	            <select id="xcorrUnit">
	        	               <option value="select">select</option>
	        	               <option value="hrm">Heart Rate</option>
	        	               <option value="f">Frequency</option>
	        	               <option value="e">Electricity Consumption</option>
	        	               <option value="deg">Degree</option>										   
	        	            </select>
	        	         </td> 
	        	         <td>
	        	           yUnit:
	        	         </td>
	        	         <td>
	        	            <select id="ycorrUnit">
	        	               <option value="select">select</option>
	        	               <option value="hrm">Heart Rate</option>
	        	               <option value="f">Frequency</option>
	        	               <option value="e">Electricity Consumption</option>
	        	               <option value="deg">Degree</option>										   
	        	            </select>
	        	         </td> 
	        	       </tr>	        	       
	        	       <tr>
	        	          <td>
	        	           <br/> <button type="button" onclick="correlation();">Submit</button>
	        	         </td>
	        	         <td>
	        	          <br/><button type="button" onclick="preselectedValues(2);">Pre-Selected Scenario</button>
	        	         </td>
	        	         <td> </td>
	        	         <td> </td>
	        	         <td> </td>
	        	       </tr>	
	        	      </table>
	        	     </tr>
	        	     <tr> 
	        		<table>
	        		    <tr>
	        		       <td id="preloader1" style="display:none;"><img src="http://preloaders.net/images/ajax-loader.gif" /></td>
	        		       <td>	        		       
	        		         <img id="imageHoldCorrelation"/>	        		         	        		         
	        		       </td>	        		    
	        		    </tr>	
	        		    <tr>
	        		      <td id="correlationCoefficient" style="display:none;">
	        		          Correlation Coefficient: <span id="correlationVal"></span>
	        		      </td>	        		      
	        		    </tr>        		
	        		</table>
	        		</tr>
	        		</table>        	
	        	</div>
	        	<div class="box-in" id="scenario3Div" style="display:none;">
	        	  <table>
	        	     <tr>
	        	     <table>
	        	       <tr>
	        	         <td>
	        	         
	        	         </td>
	        	         <td>
	        	         
	        	         </td>
	        	         <td>
	        	           <br/><h4>Anomalies</h4><br/>
	        	         </td>
	        	       </tr>
	        	       <tr>
	        	         <td>
	        	            Research Id:
	        	         </td>
	        	         <td>
	        	            <select id="anomresearchId">
	        	               <option value="select">select</option>
	        	               <option value="">ALL</option>
	        	               <option value="Ucl">UCL</option>
	        	               <option value="MS-R1">MS-R1</option>
	        	               <option value="MS-R2">MS-R2</option>
	        	               <option value="MS-R3">MS-R3</option>
	        	            </select>
	        	         </td>
	        	         <td>
	        	          Group Id:
	        	         </td>	
	        	         <td>
	        	            <select id="anomgroupId">
	        	               <option value="select">select</option>
	        	               <option value="">ALL</option>
	        	               <option value="hospital">Hospital</option>
							   <option value="home">Home</option>
	        	            </select>
	        	         </td>
	        	         <td>
	        	           Source Id:
	        	         </td>
	        	         <td>
	        	            <select id="anomsrcId">
	        	               <option value="select">select</option>
	        	               <option value="">ALL</option>
	        	               <option value="12300">12300</option>
	        	               <option value="12311">12311</option>
	        	               <option value="12322">12322</option>
	        	               <option value="12333">12333</option>
	        	               <option value="12344">12344</option>
	        	            </select>
	        	         </td>        	         	        	         
	        	       </tr>
	        	       <tr>
	        	         <td>
	        	          Category Type:	        	         
	        	         </td>
	        	         <td>
	        	           <select id="anomleafType" onchange="changeValueOption4()">
	        	               <option value="select">select</option>
	        	               <option value="">ALL</option>
	        	               <option value="deviceType">Device Type</option>
	        	               <option value="deviceId">Device Id</option>
	        	               <option value="location">Location</option>
	        	            </select>	        	         
	        	         </td>
	        	         <td>
	        	           Category Value:
	        	         </td>
	        	         <td>
	        	           <select id="anomleafValue">
	        	               <option value="select">select</option>	        	               
	        	            </select>
	        	         </td>	        	         
	        	        <td></td>
	        	        <td></td>	
	        	       </tr>
	        	       <tr>
	        	         <td>
	        	           From:
	        	         </td>
	        	         <td>
	        	           <input type="text" id="datepicker4" size="12" />
	        	         </td>
	        	         <td>
	        	           To:
	        	         </td> 
	        	         <td>
	        	           <input type="text" id="datepicker5" size="12" />
	        	         </td>
	        	         <td>
	        	           Time Scale:
	        	         </td>
	        	         <td>
	        	            <select id="anomtimeScale">
	        	               <option value="select">select</option>
	        	               <option value="hourly">Hourly</option>
							   <option value="weekly">Weekly</option>
							   <option value="monthly">Monthly</option>
							   <option value="annually">Annually</option>
	        	            </select>
	        	         </td>	        	        	        	        
	        	       </tr>
	        	       <tr>
	        	         <td>
	        	           Unit:
	        	         </td>	        	         
	        	         <td>
	        	            <select id="anomUnit">
	        	               <option value="select">select</option>
	        	               <option value="hrm">Heart Rate</option>
	        	               <option value="f">Frequency</option>
	        	               <option value="e">Electricity Consumption</option>
	        	               <option value="deg">Degree</option>										   
	        	            </select>
	        	         </td>
	        	       </tr>	        	        
	        	       <tr>
	        	          <td>
	        	            <br/><button type="button" onclick="anamolies();">Submit</button><br/>
	        	         </td>
	        	         <td>
	        	          <br/><button type="button" onclick="preselectedValues(3);">Pre-Selected Scenario</button>
	        	         </td>
	        	       </tr>	
	        	      </table>
	        	      </tr>
	        	      <tr>
	        	      <table>
	        	       <tr>
	        	          <td id="preloader3" style="display:none;"><img src="http://preloaders.net/images/ajax-loader.gif" /></td>	                
	                      <td><img id="imageHold3"/></td>
	        	       </tr> 
	        	       <tr>
	        	          <td id="anomalies" style="display:none;">
	        	            Anomalies: <span id="anomVal"></span>
	        	          </td>
	        	       </tr>       	      
	        	     </table>
	                 </tr>
	                 </table>	
	        	</div>
	        	<div class="box-in" id="scenario4Div" style="display:none;">
	        	  <table>
	        	     <tr>
	        	     <table>
	        	       <tr>
	        	         <td>
	        	         
	        	         </td>
	        	         <td>
	        	         
	        	         </td>
	        	         <td>
	        	           <br/><h4>Standard Deviation</h4><br/>
	        	         </td>
	        	       </tr>
	        	       <tr>
	        	         <td>
	        	            Research Id:
	        	         </td>
	        	         <td>
	        	            <select id="sdresearchId">
	        	               <option value="select">select</option>
	        	               <option value="">ALL</option>
	        	               <option value="Ucl">UCL</option>
	        	               <option value="MS-R1">MS-R1</option>
	        	               <option value="MS-R2">MS-R2</option>
	        	               <option value="MS-R3">MS-R3</option>
	        	            </select>
	        	         </td>
	        	         <td>
	        	           Group Id:
	        	         </td>	
	        	         <td>
	        	            <select id="sdgroupId">
	        	               <option value="select">select</option>
	        	               <option value="">ALL</option>
	        	               <option value="hospital">Hospital</option>
							   <option value="home">Home</option>
	        	            </select>
	        	         </td>
	        	         <td>
	        	           Source Id:
	        	         </td>
	        	         <td>
	        	            <select id="sdsrcId">
	        	               <option value="select">select</option>
	        	               <option value="">ALL</option>
	        	               <option value="12300">12300</option>
	        	               <option value="12311">12311</option>
	        	               <option value="12322">12322</option>
	        	               <option value="12333">12333</option>
	        	               <option value="12344">12344</option>
	        	            </select>
	        	         </td>        	         	        	         
	        	       </tr>
	        	       <tr>
	        	         <td>
	        	          Category Type:	        	         
	        	         </td>
	        	         <td>
	        	           <select id="sdleafType" onchange="changeValueOption5();">
	        	               <option value="select">select</option>
	        	               <option value="">ALL</option>
	        	               <option value="deviceType">Device Type</option>
	        	               <option value="deviceId">Device Id</option>
	        	               <option value="location">Location</option>
	        	            </select>	        	         
	        	         </td>
	        	         <td>
	        	           Category Value:
	        	         </td>
	        	         <td>
	        	           <select id="sdleafValue">
	        	               <option value="">select</option>	        	               
	        	            </select>
	        	         </td>	        	         
	        	         <td>
	        	           Graph Type:
	        	         </td>	        	         
	        	         <td>
	        	            <select id="sdgraphType">
	        	               <option value="select">select</option>
	        	               <option value="p">Point</option>
	        	               <option value="l">Line</option>
	        	               <option value="b">Point & Line</option>
	        	               <option value="h">Histogram</option>										   
	        	            </select>
	        	         </td>	
	        	       </tr>
	        	       <tr>
	        	         <td>
	        	           From:
	        	         </td>
	        	         <td>
	        	           <input type="text" id="datepicker6" size="12" />
	        	         </td>
	        	         <td>
	        	           To:
	        	         </td> 
	        	         <td>
	        	           <input type="text" id="datepicker7" size="12" />
	        	         </td>
	        	         <td>
	        	           Time Scale:
	        	         </td>
	        	         <td>
	        	            <select id="sdtimeScale">
	        	               <option value="select">select</option>
	        	               <option value="hourly">Hourly</option>
							   <option value="weekly">Weekly</option>
							   <option value="monthly">Monthly</option>
							   <option value="annually">Annually</option>
	        	            </select>
	        	         </td>	        	        	        	        
	        	       </tr>
	        	       <tr>
	        	          <td>
	        	           Unit:
	        	         </td>	        	         
	        	         <td>
	        	            <select id="sdUnit">
	        	               <option value="select">select</option>
	        	               <option value="hrm">Heart Rate</option>
	        	               <option value="f">Frequency</option>
	        	               <option value="e">Electricity Consumption</option>
	        	               <option value="deg">Degree</option>										   
	        	            </select>
	        	         </td>        	         
	        	       </tr>	        	       
	        	       <tr>
	        	          <td>
	        	            <br/><button type="button" onclick="standardDeviation();">Submit</button><br/>
	        	         </td>
	        	         <td>
	        	          <br/><button type="button" onclick="preselectedValues(4);">Pre-Selected Scenario</button>
	        	         </td>
	        	       </tr>	
	        	      </table>
	        	      </tr>
	        	      <tr>
	        	      <table>
	        	       <tr>
	        	          <td id="preloader4" style="display:none;"><img src="http://preloaders.net/images/ajax-loader.gif" /></td>	                
	                      <td><img id="imageHold4"/></td>
	        	       </tr>  
	        	       <tr>
	        	         <td id="standardDeviation" style="display:none;">
	        	           Standard Deviation: <b></b><span id="standardDevVal"></span></b>
	        	         </td>	        	         
	        	       </tr>      	      
	        	     </table>
	                 </tr>
	                 </table>	        	 
	        	</div>
	        	<div class="box-in" id="scenario5Div" style="display:none;">
	        	   <table>
	        	        <tr>
	        	          <td>
	        	            <br/><h4>Custom Script</h4><br/>
	        	          </td>
	        	        </tr>
	        	   		<tr>
	        	   			<td nowrap>
	        	   			 Enter Script: <textarea id="custScript" rows="4" cols="50" placeholder="Enter Custom Script here..."></textarea>
	        	   			</td>	        	   		
	        	   		</tr>
	        	   		<tr>
		        	   		<td>
		        	   		<br/><button type="button" onclick="customScript();">Submit</button><br/>
		        	   		</td>
	        	   		</tr>
	        	   		<tr>
	        	   		  <td nowrap>
	        	   		    <br/><font color="red">Example Scripts : </font><br/>
	        	   		  </td>	        	   		  
	        	   		</tr>
	        	   		<tr>
	        	   		   <td><br/><font color="red">1. value.cooling<-c(@get::MS-R1::home::::cooling::deviceType::08/09/2013 00:00::09/09/2013 00:00::hourly::e@)</font></td>
	        	   		</tr>	
	        	   		<tr>
	        	   		   <td><br/></td>
	        	   		</tr>	        	   		     
	        	   		<tr>
	        	   		   <td id="preloader5" style="display:none;"><img src="http://preloaders.net/images/ajax-loader.gif" /></td>
	        	   		   <td id="custScriptAns" style="display:none;">
	        	               Returned Value: <b><span id="answer"></span></b>
	        	         </td>
	        	   		</tr>   	   
	        	   </table>
	        	</div>
	        </div>
            <div id="content_bottom"></div>            
            <div id="footer"><h3><a style="color:#FFFFFF" href="http://labofthingsanalytics.codeplex.com/" target="_blank">&#169;UCL LoT Analytics Engine Team, 2013. All rights reserved.</a></h3></div>
      </div>
   </div>
</body>
</html>
